using System;
using System.Web.UI.WebControls;
using THANHTUNGO.Portal.Components.Settings;
using THANHTUNGO.Portal.Components.UI;

namespace THANHTUNGO.Portal.Modules.MODULE
{
    public partial class ModuleType : PortalModuleControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.ModuleTitle.AddUrl = "~/Modules/MODULE/ModuleDefinition.aspx?defId=-1&tabindex=" + this.TabIndex + "&tabid=" + this.TabID;

                Configuration config = new Configuration();
                dlModuleDefinitions.DataSource = config.GetModuleDefinitions(this.PortalSettings.ID);
                dlModuleDefinitions.DataBind();
            }
        }

        protected void dlModuleDefinitions_EditCommand(object source, DataListCommandEventArgs e)
        {
            int moduleDefId = (int) dlModuleDefinitions.DataKeys[e.Item.ItemIndex];
            Response.Redirect("~/Modules/MODULE/ModuleDefinition.aspx?defId=" + moduleDefId + "&tabindex=" + this.TabIndex + "&tabid=" + this.TabID);
        }
    }
}